package com.haopt.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.util.Date;
import java.util.concurrent.*;
import java.util.regex.Pattern;

/**
 *
 */
@Slf4j
public class MySimpleJob implements SimpleJob {
    @Autowired
    private ThreadPoolExecutor executor;

    @Override
    public void execute(ShardingContext shardingContext) {
        //分片总数量
        int totalCount = shardingContext.getShardingTotalCount();
        //当前分片
        int item = shardingContext.getShardingItem();
        log.info("作业任务被执行了" + new Date() + "总分片数量" + totalCount + "当前分片:" + item);
    }

    public static void main(String[] args) {
        String str = "6.7604536E7";
//        String str = "6.0E-4";
        String regx = "[+-]*\\d+\\.?\\d*[Ee]*[+-]*\\d+";
        Pattern pattern = Pattern.compile(regx);
        boolean isNumber = pattern.matcher(str).matches();
        if (isNumber) {
            BigDecimal bd = new BigDecimal(str);
            String num = bd.toPlainString();
            System.out.println(num);
        }
    }

}
